<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="reportTitle" value="IV工艺测试Chart图报表" />

<%@ include file="/common/report_head.jsp" %>
<%@ include file="/condition/sartTime_input.html"%>
<%@ include file="/condition/endTime_input.html"%>
<%@ include file="/condition/fab_sumo.html"%>
<%@ include file="/condition/line_sumo.html"%>
<%@ include file="/condition/toolType_radio.html"%>
<%@ include file="/condition/tool_sumo_must.html"%>
<%@ include file="/condition/lotNumber_sumo.html"%>

<%@ include file="/common/report_middle.jsp" %>
<%@ include file="/charts-grid/echarts2.html"%>
<%@include file="/common/report_end.jsp" %>


<script>
    $(document).ready(function () {
        $("title").text("IV工艺测试Chart图报表");
        $("label:contains('设备代码:')").addClass("keyCss");
        $("label:contains('校准板:')").addClass("keyCss");

        $('#query_btn').click(function (){
            if($("#toolIdSumo").val() === null || $("#toolIdSumo").val() === '' || $("#lotNumberSumo").val() === null || $("#lotNumberSumo").val() === ''){
                showErrorDialog("0000002", "设备和校准板为必选项"); return false;
            }
            initGridAndChart();
            ajax('/jn-report/report/ivTest_chart_report.do' ,loadConditionMapData(), true, ajax_successful);

            function ajax_successful(outTrxObj) {
                if(outTrxObj.chartsData.length < 1) { showMessengerDialog("数据查询为空"); return false; }

                //Chart图数据
                var echartsData = outTrxObj.chartsData;
                option.backgroundColor = 'white';
                option.grid.show = false;
                option.title.text = echartsData.title;
                option.legend.data = [];
                option.legend.data = echartsData.legendData;
                option.xAxis[0].data = [];
                option.xAxis[0].data = echartsData.xAxisData;
                option.series = [];
                for (var i = 0; i < echartsData.seriesDatas.length; i++) {
                    option.series.push({
                        name: echartsData.legendData[i],
                        type: 'line',
                        data: echartsData.seriesDatas[i],
                        //label: {normal: {show: true, color: 'green'}}
                    });
                }
                //Chart图上最大、最小、中心线段
                if (outTrxObj.hasOwnProperty("max_pm_value")){
                    option.series.push({
                        type: 'line',
                        markLine: {
                            silent: true,//不响应鼠标事件
                            itemStyle: {
                                normal: { lineStyle: { color:'red' },label: { position:'end', formatter: 'Max PM' } }
                            },
                            data: [{yAxis: outTrxObj.max_pm_value}, {yAxis: outTrxObj.max_pm_value}]
                        }
                    });
                }
                if (outTrxObj.hasOwnProperty("center_pm_value")){
                    option.series.push({
                        type: 'line',
                        markLine: {
                            silent: true,//不响应鼠标事件
                            itemStyle: {
                                normal: { lineStyle: { type: 'solid', color:'blue' },label: { position:'end', formatter: 'Center PM' } }
                            },
                            data: [{yAxis: outTrxObj.center_pm_value}, {yAxis: outTrxObj.center_pm_value}]
                        }
                    });
                }
                if (outTrxObj.hasOwnProperty("min_pm_value")){
                    option.series.push({
                        type: 'line',
                        markLine: {
                            silent: true,//不响应鼠标事件
                            itemStyle: {
                                normal: { lineStyle: { color:'red' },label: { position:'end', formatter: 'Min PM' } }
                            },
                            data: [{yAxis: outTrxObj.min_pm_value}, {yAxis: outTrxObj.min_pm_value}]
                        }
                    });
                }
                //最大/最小显示范围的设置
                option.yAxis[0].max = echartsData.maxValue;
                option.yAxis[0].min = echartsData.minValue;
                myChart.clear();
                myChart.setOption(option);
            }
        });

    });
</script>
